#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <cstring>
#include <math.h>
using namespace std;
struct Peo
{
	int id;
	int marks;
};
vector<Peo> peo;
bool cmp(const Peo& a, const Peo& b)
{
	if (a.marks != b.marks)
		return a.marks > b.marks;
	else
		return a.id < b.id;
}
int main()
{
	int n, m, ID, MARKS;
	scanf("%d%d", &n, &m);
	int rank = (int)(m * 1.5);
	for (int i = 0; i < n; i++)
	{
		scanf("%d%d", &ID, &MARKS);
		peo.emplace_back(Peo{ ID, MARKS });
	}
	sort(peo.begin(), peo.end(), cmp);
	printf("%d ", peo[rank - 1].marks);
	int cnt = rank;
	for (int i = rank; i < n; i++)
	{
		if (peo[i].marks >= peo[rank - 1].marks)
		{
			cnt++;
		}
	}
	printf("%d\n", cnt);
	for (int i = 0; i < cnt; i++)
	{
		printf("%d %d\n", peo[i].id, peo[i].marks);
	}
	return 0;
}